package structure.flyweight;

/**
 * 街道享元对象
 */
public class StreetFlyWeight implements CityFlyWeight {

    private String intrinsicState;
    /**
     * 构造函数，内蕴状态作为参数传入
     * @param state
     */
    public StreetFlyWeight(String state){
        this.intrinsicState = state;
    }

    /**
     * 外蕴状态作为参数传入方法中，改变方法的行为，
     * 但是并不改变对象的内蕴状态。
     */
    @Override
    public void operation(String extrinsicState) {
        System.out.println("intrinsicState:" + intrinsicState + " extrinsicState:" + extrinsicState);
    }

}
